/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Calendar;
import java.util.Locale;
import java.util.Random;

/**
 * <p>Project: javase202202 - If2
 * <p>Powered by Lisi On 2022-05-31 16:13:20
 * <p>Created by IntelliJ IDEA
 *

 * @version 1.0
 * @since 17
 */
public class If2 {
    public static void main(String[] args) {
        System.out.printf("1今日是：%tA%n", System.currentTimeMillis());
        String info = String.format("2今日是：%tA%n", System.currentTimeMillis());
        System.out.println(info);


        //var d = new Date();
        //d.getDay() 0-6 星期日

        var c = Calendar.getInstance();
        //1-7 1 星期日 2 星期一 3 星期二
        var k = c.get(Calendar.DAY_OF_WEEK);
        //System.out.println(k);

        if (k == 1) {
            System.out.println("星期日");
        } else if (k == 2) {
            System.out.println("星期一");
        } else if (k == 3) {
            System.out.println("星期二");
        } else if (k == 4) {
            System.out.println("星期三");
        } else if (k == 5) {
            System.out.println("星期四");
        } else if (k == 6) {
            System.out.println("星期五");
        } else {
            System.out.println("星期六");
        }


        System.out.println("3今日：星期" + "日一二三四五六".charAt(k - 1));

        var year = c.get(Calendar.YEAR);
        year = 2023;
        System.out.println("猴鸡狗猪鼠牛虎兔龙蛇马羊".charAt(year % 12));

        Locale.setDefault(Locale.US);
        System.out.printf("%tp%n", System.currentTimeMillis());


        var rand = new Random();
        // ? : 三元运算表达式，相当于if(){}else{}
        var mm = rand.nextBoolean() ? 2*2: "aaa";
        System.out.println(mm);
    }
}
